package com.example.houtai.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.houtai.entity.SysInterfaceInfo;
import com.example.houtai.service.ISysInterfaceInfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.org.dto.InterfaceDto;
import com.org.vo.ResultEntity;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 龚梦
 * @since 2021-03-24
 */
@RestController
@RequestMapping("/sys/interface")
public class SysInterfaceInfoController {
    @Autowired
    private ISysInterfaceInfoService interfaceInfoService;
    @RequestMapping("list")
    public ResultEntity list(@RequestBody InterfaceDto interfaceDto){
        PageInfo<SysInterfaceInfo>page=interfaceInfoService.interfaceList(interfaceDto);
        return ResultEntity.ok("查询成功",page);
    }
    @RequestMapping("save")
    public ResultEntity save(@RequestBody InterfaceDto interfaceDto){
        SysInterfaceInfo interfaceInfo=new SysInterfaceInfo();
        BeanUtils.copyProperties(interfaceDto,interfaceInfo);
        interfaceInfoService.save(interfaceInfo);
        return ResultEntity.ok("添加成功");
    }
    @RequestMapping("update")
    public ResultEntity update(@RequestBody InterfaceDto interfaceDto){
        interfaceInfoService.Interfaceupdate(interfaceDto);
        return ResultEntity.ok("修改成功");
    }
    @RequestMapping("delete")
    public ResultEntity delete(@RequestParam("ids") String[] ids){
        interfaceInfoService.deletes(ids);
        return ResultEntity.ok("删除成功");
    }
}
